(function() {
  'use strict';

  angular.module('starter.pages.bugs.services', [])
    .factory('BugsServices', function() {
      var bugs = [{
        id: 0,
        name: 'Ben Sparrow',
        lastText: 'You on your way?',
        face: 'img/ben.png'
      }, {
        id: 1,
        name: 'Max Lynx',
        lastText: 'Hey, it\'s me',
        face: 'img/max.png'
      }, {
        id: 2,
        name: 'Adam Bradleyson',
        lastText: 'I should buy a boat',
        face: 'img/adam.jpg'
      }, {
        id: 3,
        name: 'Perry Governor',
        lastText: 'Look at my mukluks!',
        face: 'img/perry.png'
      }, {
        id: 4,
        name: 'Mike Harrington',
        lastText: 'This is wicked good ice cream.',
        face: 'img/mike.png'
      }];

      return {
        all: function() {
          return bugs;
        },
        remove: function(bug) {
          chats.splice(bugs.indexOf(bug), 1);
        },
        get: function(bugId) {
          for (var i = 0; i < bugs.length; i++) {
            if (bugs[i].id === parseInt(bugId)) {
              return bugs[i];
            }
          }
          return null;
        }
      };
    });

})();
